    <style type="text/css">
    .belongToLi
    {
    	display: inline;
    	list-style-type: none;
    	padding-right: 20px; 
    }
    </style>
    <script src="/public/library/hvn/place.js" type="text/javascript"></script>
	<script src="/public/library/autocomplete/autocomplete.js" type="text/javascript"></script>
	<link rel="stylesheet" href="/public/library/autocomplete/autocomplete.css" type="text/css">
<div class="box white_bg" style="background-color:#ffffff">
<form accept-charset="UTF-8" action="<?= $this->escape($this->viewParams['form']->getAction()) ?>"
      method="<?= $this->escape($this->viewParams['form']->getMethod()) ?>" >
      
<script language="Javascript">

$(function(){
	setAutoComplete("belong_to_ac_input", "belong_to_ids", "belong_to_names", "results", "/en/place/ajax/autocomplete?part=");//"/public/library/autocomplete/autocomplete.php?part=");
	
	$("form").submit(function(){
		var tmp = '';
		var ids = '';
		var dis = '';
		$("#belong_to_names ul li").each(function(i){
			//get ids: $(this).attr('name')
			//get name, ids and distance
			if (tmp == '' && ids == '')
			{
				tmp = $(this).find("span:first").text();
				ids = $(this).attr('name');
				dis = $(this).find("span:last").text();
			}
			else
			{
				tmp = tmp + ',' + $(this).find("span:first").text();
				ids = ids + ',' + $(this).attr('name');
				dis = dis + ',' + $(this).find("span:last").text();
			}
		});
		$("#belong_to_ids").val(ids);
		$("#belong_to_names_submit").val(tmp);
		$("#distance").val(dis);
	});
	
	//populate belong_to_names_submit & "belong_to_names ul"
	function create_belong_to_ul(belongToIds, belongToNamesSubmit, belongToNames)
	{
		if($("#" + belongToIds).val() != null)
		{
			ids = $("#" + belongToIds).val().split(',');
			//console.log(ids);
			names = $("#" + belongToNamesSubmit).val().split(',');
			dis = $("#distance").val().split(',');
			belongNames = "#" + belongToNames;
			
			if (ids.length > 0 && ids[0] != '')
			{
				for (j = 0;j < ids.length; j++)
				{
					name = names[j];
					id = ids[j];
					d = dis[j];
					$newLi = $("<li name='" + id + "' ><span>" + name + " </span>" + "<span>" + d + "</span>" +' km'
								+ "<sup><a href='javascript:void()'>remove</a></sup></li>");
					$newLi.appendTo($(acTargetName +" ul"));
					
					//update dom again
					update_remove_place_actions($newLi);
				}
			}
		}
	}
	
	create_belong_to_ul("belong_to_ids", "belong_to_names_submit", "belong_to_names");
	
	$("#belong_to_ac_input").attr('autocomplete', 'OFF');
	
	$('.belongToDOMWindow').openDOMWindow({ 
		height:200, 
		width:365, 
		eventType:'click',
		windowSourceID:'#groupId',  
		overlay:0, 
		windowBGColor:'#FFFF00', 
		borderColor:'#5D5DF4', 
		overlayOpacity:15  
		}); 
	$('.closeBelongToDOMWindow').closeDOMWindow({eventType:'click'}); 
	
	var mode = '';
    getAddress(mode);
    getCategoryType(mode);

});
</script>

<style type="text/css" >
  .meals { background:#FFFFF; margin:3px 3px 5px 5px; width:100px; 
        height:100px; float:left; }
</style>
   
<?if ($this->justMessage == 1) :?>
<?=t(769) ?>
<?endif ?>
<?if (!empty($this->successMessage)) :?>
<div class="successMessage"><?=$this->successMessage; ?></div>
<a href="<?=$this->hvnUrl(array('module' => 'place', 'action' => 'view'))?>?id=<?=$this->viewParams['id']?>"><?=t(134)?></a>
<?endif?>

<div class="errorMessage"><?=$this->errorMessage; ?></div>


<fieldset class="expansible"><legend><span><?=t(821) ?></span></legend>
	<table>
		<tr>
			<td><?=t(796) ?>:</td>
			<td><?= $this->viewParams['form']->area?> (<?=t(797) ?>)</td>
		</tr>
		<? $restaurant = Zend_Registry::get('configuration')->restaurant;?>
			<?if($this->viewParams['rtype'] == $restaurant && !empty($this->viewParams['form']->opening_hours)) :?>
				<tr>
					<td><?=t(768) ?>:</td>
					<td><?= $this->viewParams['form']->opening_hours?> (e.g: 07:00 - 22:00)</td> 
				</tr>
			<?endif?>
		<?if(!empty($this->viewParams['form']->belong_to_ids)) :?>
		<tr>
			<td><?=t(765) ?>:</td>
			<td>
				<input type="button" class="belongToDOMWindow" value="Add" /> 
				<div id="groupId" style="display:none;"> 
				<table>
						<tr>
							<td><?=t(767) ?>:</td>
							<td><?if(isset($this->viewParams['district_name'])) :?>
								<?=$this->viewParams['district_name']?> -<?endif?> 
								<?=$this->viewParams['city_name']?>
							</td>
						</tr>
						<tr>
							<td><?=t(766) ?>:</td>
							<td><?= $this->viewParams['form']->category?></td>
						</tr>
						<tr>
							<td><?=t(115) ?>:</td>
							<td><?= $this->viewParams['form']->rtype?></td>
						</tr>
						<tr>
							<td><?=t(765) ?>:</td>
							<td><?= $this->viewParams['form']->belong_to_ac_input?> <span id="newBelongToPlaceId"></span></td>
							<td><div id="resultID"></div></td>
						</tr>
						<tr>
							<td></td>
							<td><?= $this->viewParams['form']->length?>(km)</td>
						</tr>
						<tr>
							<td></td>
							<td>
							<div align="right">
							<input type="button" value="Add" class="belongButton" />
							<input type="button" value="Close" class="closeBelongToDOMWindow" />
							</div>
							</td>
						</tr>
					</table>
				</div>
			</td>
		</tr>
		<tr>
			<td></td>
			<td> <span id="belong_to_names">
			    <ul> 
				</ul>
				</span>
			</td>
		</tr>

		<tr>
			<td></td>
			<td><?= $this->viewParams['form']->belong_to_ids?> <br/>
			<?= $this->viewParams['form']->belong_to_names_submit?>
			<?= $this->viewParams['form']->distance ?>
			</td>
		</tr>
		<?endif?>
		
		
	</table>	
</fieldset>

<?if(!empty($this->viewParams['form']->fee)) :?>
<fieldset class="expansible"><legend><span><?=t(764) ?></span></legend>
	<table>
	<tr>
		<td><?=t(764) ?></td>
		<td><?= $this->viewParams['form']->fee ?></td>
	</tr>
	<tr>
		<td><?=t(763) ?>:</td>
		<td><?= $this->viewParams['form']->fee_basis ?></td>
	</tr>
	<tr>
		<td><?=t(762) ?>:</td>
		<td><?= $this->viewParams['form']->fee_currency ?></td>
	</tr>
	<tr>
		<td><?=t(785) ?>:</td>
		<td><?= $this->viewParams['form']->payment_method?></td>
	</tr>
</table>
</fieldset>
<?endif?>

<? $restaurant = Zend_Registry::get('configuration')->restaurant;?>
<?if($this->viewParams['rtype'] == $restaurant && !empty($this->viewParams['form']->take_away)) :?>
<fieldset class="expansible"><legend><span><?=t(760) ?></span></legend>
	<table>
		<tr>
			<td><?=t(758) ?>:</td>
			<td><?= $this->viewParams['form']->take_away?></td>
		</tr>
		<tr>
			<td><?=t(759) ?>:</td>
			<td><?= $this->viewParams['form']->delivery?></td>
		</tr>
		<tr>
			<td><?=t(757) ?>:</td>
			<td><?= $this->viewParams['form']->meals?></td>
		</tr>
	</table>
</fieldset>
<?endif?>


<? $pagoda = Zend_Registry::get('configuration')->pagoda;?>
<?if($this->viewParams['rtype'] == $pagoda && !empty($this->viewParams['form']->built_year)) :?>
<fieldset class="expansible"><legend><span><?=t(756) ?></span></legend>
	<table>
		<tr>
			<td><?=t(755) ?>:</td>
			<td><?= $this->viewParams['form']->built_year?></td>
		</tr>
		<tr>
			<td><?=t(754) ?>:</td>
			<td><?= $this->viewParams['form']->festive_days_from ?></td>
		</tr>
		<tr>
			<td><?=t(753) ?>:</td>
			<td><?= $this->viewParams['form']->festive_days_to?></td>
		</tr>
	</table>
</fieldset>
<?endif?>

<fieldset class="expansible"><legend><span><?=t(825) ?></span></legend>
	<table>
		<tr>
			<td><?=t(750) ?>:</td>
			<td><?= $this->viewParams['form']->phone?></td>
		</tr>
		<tr>
			<td><?=t(751) ?>:</td>
			<td><?= $this->viewParams['form']->fax?></td>
		</tr>
		<tr>
			<td><?=t(752) ?>:</td>
			<td><?= $this->viewParams['form']->contact_email ?></td>
		</tr>
		<tr>
			<td><?=t(824) ?>:</td>
			<td><?= $this->viewParams['form']->website ?></td>
		</tr>
	</table>
</fieldset>

<?// $hotel = Zend_Registry::get('configuration')->hotel;?>
<?// foreach ($hotel as $k => $h) :?>
    <? if (3 == $this->viewParams['rtype'] && !empty($this->viewParams['form']->number_of_rooms)) :?> 
	<fieldset class="hotel"><legend><span><?=t(749) ?></span></legend>
		<table>
			<tr>
				<td><?=t(747) ?>:</td>
				<td><?= $this->viewParams['form']->number_of_rooms ?></td>
			</tr>
			<tr>
				<td><?=t(748) ?>:</td>
				<td><?= $this->viewParams['form']->number_of_available_rooms ?></td>
			</tr>
		</table>
	</fieldset>
	<?endif?>
<?//endforeach?>

<fieldset class="expansible"><legend><span><?=t(21) ?></span></legend>
	<table>
		<tr>
			<td><?= $this->viewParams['form']->article_body ?></td>
		</tr>
		<tr>
			<td><?=$this->viewParams['form']->article_originality ?></td>
		</tr>
		
	</table>
</fieldset>


<?=$this->viewParams['form']->update ?>

<input type="hidden" name="id" value="<?= $this->viewParams['id']; ?>" />
<input type="hidden" name="district_name" value="<?if(isset($this->viewParams['district_name'])):?><?= $this->viewParams['district_name']; ?><?endif?>" />
<input type="hidden" name="city_name" value="<?if(isset($this->viewParams['city_name'])):?><?= $this->viewParams['city_name']; ?><?endif?>" />
<input type="hidden" name="rtype" value="<?if(isset($this->viewParams['rtype'])):?><?= $this->viewParams['rtype']; ?><?endif?>" />
</form>
</div>